package com.server.db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DeleteData {
	public static DeleteData instance;
	public static DeleteData GetInstance(){
		if(instance == null){
			instance = new DeleteData();
		}
		return instance;
	}
	
	/**
	 * 删除管理员
	 * @param account_id 管理员id
	 * @return
	 * @throws SQLException
	 */
	public boolean DeleteAccount(long account_id) throws SQLException {
		boolean isSuccess = false;
		String sql = "delete from account where account_id = ?";
		Connection conn = DBPool.getConnection();
    	PreparedStatement pstmt = null;
    	try {
			pstmt = conn.prepareStatement(sql);
			pstmt.setLong(1, account_id);
	        pstmt.executeUpdate();
	        isSuccess = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
    	pstmt.close();
    	conn.commit();
    	conn.close();
    	return isSuccess;
	}
}
